import HttpRequest from "../request";

/**
 * 获取所有外卖信息
 *
 */
export async function getAllProduct(params) {
  return HttpRequest({
    url: "/product",
    method: "GET",
    params: params,
  });
}

// 上传产品图片
export async function uploadProduct(params) {
  return HttpRequest({
    url: "/upload/file",
    method: "POST",
    params: params,
  });
}
/**
 * 添加外卖信息
 *
 */
export async function addProduct(params) {
  return HttpRequest({
    url: "/product",
    method: "POST",
    params: params,
  });
}

/**
 * 删除外卖信息
 *
 */
export async function delProduct(id) {
  return HttpRequest({
    url: `/product/${id}`,
    method: "DELETE",
  });
}

/**
 * 修改外卖信息
 *
 */
export async function updateProduct(id, params) {
  return HttpRequest({
    url: `/product/${id}`,
    method: "PATCH",
    params: params,
  });
}
